function drawEllipse(ctx, x, y, w, h) { var kappa = .5522848; ox = (w / 2) * kappa, // control point offset horizontal oy = (h / 2) * kappa, // control point offset vertical xe = x + w, // x-end ye = y + h, // y-end xm = x + w / 2, // x-middle ym = y + h / 2; // y-middle ctx.beginPath(); ctx.moveTo(x, ym); ctx.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); ctx.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); ctx.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); ctx.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); ctx.closePath(); ctx.stroke(); ctx.fill(); } function drawGeneralShape(ctx, x, y, w, h, path) { var strs= new Array(); //array w=h; strs=path.split(" "); //split if (strs[0]=="V"){ ctx.beginPath(); var x1 = eval(strs[1]*w/21600); var y1 = eval(strs[2]*h/21600); var x2 = eval(strs[3]*w/21600); var y2 = eval(strs[4]*h/21600); var x3 = eval(strs[5]*w/21600); var y3 = eval(strs[6]*h/21600); var x4 = eval(strs[7]*w/21600); var y4 = eval(strs[8]*h/21600); var x = eval((x1+x2)/2); // x coordinate var y = eval((y1+y2)/2); // y coordinate var radius = eval((x2-x1)/2); // Arc radius var startAngle = eval(Math.atan((y3-y)/(x3-x))); // Starting point on circle var endAngle = eval(Math.atan((y4-y)/(x4-x))); // End point on circle var anticlockwise = false; // clockwise or anticlockwise ctx.arc(x,y,radius,startAngle,endAngle, anticlockwise); ctx.lineTo(x,y); ctx.lineTo(x3,y3); if (strs[13]=="N"){ ctx.fill(); } } } //Table 11 - Functions Used in draw:formula function SVGif(var_c,var_x,var_y){ return var_c > 0 ? var_x : var_y; }